package com.lhh.core;


/**
 * 统一API响应结果封装
 */
public class Result {
    private int code;
    private String msg;
    private Object data;
    private int uid;
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public int getUid() {
		return uid;
	}
	public void setUid(int uid) {
		this.uid = uid;
	}

	public static Result success(String msg, Object data) {
		Result result = new Result();
		result.code = 0;
		result.msg = msg;
		result.data = data;
		return result;
	}

	public static Result success(String msg,Object data,int uid){
		Result result = new Result();
		result.code = 1;
		result.msg = msg;
		result.data = data;
		result.uid = uid;
		return result;
	}

	public static Result fail(String msg) {
		Result result = new Result();
		result.code = -1;
		result.msg = msg;
		return result;
	}

}
